/**
 *  TiniSatJ :: A Java implemented SAT Solver based on Tinisat 0.22
 *
 *  Copyright (C) 2007 KITAGAWA, Satoshi.
 *
 *  Original TiniSat is available from
 *  http://users.rsise.anu.edu.au/~jinbo/tinisat/
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

package com.googlecode.tinisat_j;

import java.util.Vector;

public class Var {
    public static final byte NEGA = 0;
    public static final byte POSI  = 1;
    public static final byte FREE = 2;

    public int id;
    public boolean mark;
    public byte phase;
    public byte value;
    public int dLevel;
    public int[] ante;
    public int[] activity;
    public int[][] imp;

    Vector<int[]>[] watch;

    @SuppressWarnings("unchecked")
    public Var(int id) {
        this.id = id;
        mark = false;
        value = FREE;
        activity = new int[] { 0, 0 };
        watch = new Vector[] {
                new Vector<int[]>(),
                new Vector<int[]>()
        };
        imp = new int[2][];
    }

    public static byte SIGN(int lit) {
        return ( (lit > 0) ? POSI : NEGA );
    }

    public static int VAR(int lit) {
        return Math.abs(lit);
    }

    public static int NEG(int lit) {
        return (-lit);
    }

    public int score() {
        return (activity[POSI] + activity[NEGA]);
    }
}
